#ifndef sheet_cell_impl_h
#define sheet_cell_impl_h

#include "../include/sheet.h"

#include <common/include/variant.h>
using cmn::variant;

class entry_impl;

class cell_impl : public excel::cell
{
public:
	cell_impl(entry_impl* _parent, const variant& _v)
	{
		m_entry = _parent;
		m_value = _v;
	}

	inline virtual cmn::dword release()
	{
		delete this;
		return 0;
	}

	inline virtual int		get_type()
	{
		int c = get_column();
		return get_sheet()->get_type(c);
	}

	inline virtual int		to_int()			{ return static_cast<int>(m_value); }

	inline virtual float	to_float()			{ return static_cast<float>(m_value); }

	inline virtual kcstr	to_string()			{ return static_cast<kcstr>(m_value); }

	inline virtual kcwstr	to_wstring()		{ return static_cast<kcwstr>(m_value); }

	inline virtual int		get_column()		{ return m_entry->get_column(this); }

	inline virtual excel::entry* get_entry()	{ return m_entry; }

	inline virtual excel::sheet* get_sheet()	{ return get_entry()->get_sheet(); }

private:
	entry_impl* m_entry;

	variant m_value;
};

#endif	//sheet_cell_impl_h
